<template>
    <div>
        <span  v-text="name" class="red"></span>
        <button @click="add1(2,2)">加法运算</button>
        <button @click="sub(5,2)">减法运算</button>
        <br/>
        <router-link  to="/login">登录</router-link>
        <router-link  to="/register">注册</router-link>
        <!--路由占位符-->
        <router-view></router-view>
        <!-- 使用mint ui的button组件-->
    </div>
</template>

<script>
    //按需导入
    import {add,sub} from "./calc.js";
    import { Toast } from 'mint-ui';
  //  function add(x,y){ console.log(x+y)}
    //module.exports={
   export default{
        data(){
            return {
                name: 'testt123213sss'
            }
        },
        methods:{
           // add, //es6的写法 add:add
            add: add,
            sub: sub,
            tip:function(){
                Toast('您好');
            }
          // sub:calc.sub
        },
        created(){

      }
    }
</script>

<style scoped>
 .red{
     color:red;
 }
</style>